package com.qidian.mes.dv.controller;

import com.qidian.mes.dv.service.MachineryTypeService;
import com.qidian.mes.pojo.dv.MachineryType;
import com.qidian.mes.util.pojo.MESResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 迄氺(甄闯)
 * @Company 空白
 * @Time 2023/10/25 20:05
 * @Description
 */
@RestController
@RequestMapping("/machineryType")
@CrossOrigin
public class MachineryTypeController {

    @Autowired
    private MachineryTypeService machineryTypeService;

    @GetMapping("/get")
    public MESResult get(Long machineryTypeId){
        return machineryTypeService.selectById(machineryTypeId);
    }
    @PostMapping("/save")
    public MESResult save(@RequestBody MachineryType machineryType){
        return machineryTypeService.save(machineryType);
    }


    @PutMapping("/update")
    public MESResult update(@RequestBody MachineryType machineryType){
        return machineryTypeService.update(machineryType);
    }
    @GetMapping("/list")
    public MESResult list(String machineryTypeName,String enableFlag){
        //你就在这个list方法里改
        // 前端传参数  后端能接收到  你就改成这样先 我就是不知道怎么在这里面改
        ////我能直接在这里加参数?
        return machineryTypeService.selectAll(machineryTypeName,enableFlag);
    }
    @DeleteMapping("/deleteById")
    public MESResult deleteById( Long machineryTypeId){
        return machineryTypeService.deleteById(machineryTypeId);
    }

}
